
package com.w7vm.menuweb.entity;

import java.io.Serializable;
import javax.persistence.*;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * The persistent class for the ContratoWeb database table.
 * 
 */
@Entity
@NamedQueries({
	@NamedQuery(name="Contrato.findContratoByNumero", 
			query="SELECT c" +
					" FROM ContratoWeb c" +
					" JOIN c.contratoRestaurantesWebs cr " +
					" JOIN c.contratoPagamentoWebs ph " +
					" WHERE c.numeroContrato = :numeroContrato"),
				
	@NamedQuery(name="Contrato.findContratoByIDRestaurante", 
			query="SELECT c" +
							" FROM ContratoWeb c" +
							" JOIN c.contratoRestaurantesWebs cr" +
							" JOIN cr.restauranteSedeWeb s" +
							" JOIN c.contratoPagamentoWebs ph " +
							" JOIN c.planoSy pl " +
							" WHERE s.idRestauranteSedeWeb = :idRestaurante"),

})

public class ContratoWeb implements Serializable {
	
	private static final long serialVersionUID = 1L;
	public static final String FIND_CONTRATO_BY_NUMERO = "Contrato.findContratoByNumero";
	public static final String FIND_CONTRATO_BY_IDRESTAURANTE = "Contrato.findContratoByIDRestaurante";

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int idContratoWeb;

    @Temporal( TemporalType.DATE)
	@Column(name="DataAlt")
	private Date dataAlt;

    @Temporal( TemporalType.DATE)
	@Column(name="DataContratacao")
	private Date dataContratacao;

    @Temporal( TemporalType.DATE)
	@Column(name="DataTermino")
	private Date dataTermino;

    @Temporal( TemporalType.DATE)
	@Column(name="DataInc")
	private Date dataInc;

	@Column(name="ContratoEmNome")
	private String contratoEmNome;
	
	@Column(name="NomeResponsavel")
	private String nomeResponsavel;

	@Column(name="InsEstadual")
	private int insEstadual;
	
	@Column(name="CPF")
	private String cpf;

	@Column(name="CNPJ")
	private String cnpj;

	@Column(name="NumeroContrato")
	private int numeroContrato;

	@Column(name="Status")
	private int status;

	//bi-directional many-to-one association to ContratoRestaurantesWeb
	@OneToMany(mappedBy="contratoWeb", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	private Set<ContratoRestaurantesWeb> contratoRestaurantesWebs;

	//bi-directional many-to-one association to ContratoCreditoPagamentoWeb
	@OneToMany(mappedBy="contratoWeb",fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	private Set<ContratoCreditoPagamentoWeb> contratoCreditoPagamentoWebs;



	//bi-directional many-to-one association to PlanoSy
    @ManyToOne
	@JoinColumn(name="idPlano")
	private PlanoSy planoSy;

	//bi-directional many-to-one association to PagamentoHistoricoWeb
	@OneToMany(mappedBy="contratoWeb",fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	private Set<ContratoPagamentoWeb> contratoPagamentoWebs;

//	//bi-directional many-to-one association to UsuarioWeb
//	@OneToMany(mappedBy="contratoWeb", cascade=CascadeType.PERSIST)
//	private Set<UsuarioWeb> usuarioWebs;

    public ContratoWeb() {
    }

	public int getIdContratoWeb() {
		return this.idContratoWeb;
	}

	public void setIdContratoWeb(int idContratoWeb) {
		this.idContratoWeb = idContratoWeb;
	}

	public Date getDataAlt() {
		return this.dataAlt;
	}

	public void setDataAlt(Date dataAlt) {
		this.dataAlt = dataAlt;
	}

	public Date getDataContratacao() {
		return this.dataContratacao;
	}

	public void setDataContratacao(Date dataContratacao) {
		this.dataContratacao = dataContratacao;
	}

	public Date getDataTermino() {
		return this.dataTermino;
	}

	public void setDataTermino(Date dataTermino) {
		this.dataTermino = dataTermino;
	}

	public String getNomeResponsavel() {
		return this.nomeResponsavel;
	}

	public void setNomeResponsavel(String nomeResponsavel) {
		this.nomeResponsavel = nomeResponsavel;
	}

	public int getNumeroContrato() {
		return this.numeroContrato;
	}

	public void setNumeroContrato(int numeroContrato) {
		this.numeroContrato = numeroContrato;
	}

	public int getStatus() {
		return this.status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Set<ContratoRestaurantesWeb> getContratoRestaurantesWebs() {
		return this.contratoRestaurantesWebs;
	}

	public void setContratoRestaurantesWebs(Set<ContratoRestaurantesWeb> contratoRestaurantesWebs) {
		this.contratoRestaurantesWebs = contratoRestaurantesWebs;
	}
	
	public PlanoSy getPlanoSy() {
		return this.planoSy;
	}

	public void setPlanoSy(PlanoSy planoSy) {
		this.planoSy = planoSy;
	}
	
	public String getCpf() {
		return cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	public Date getDataInc() {
		return this.dataInc;
	}

	public void setDataInc(Date dataInc) {
		this.dataInc = dataInc;
	}

	public String getCnpj() {
		return cnpj;
	}

	public void setCnpj(String cnpj) {
		this.cnpj = cnpj;
	}

	public int getInsEstadual() {
		return insEstadual;
	}

	public void setInsEstadual(int insEstadual) {
		this.insEstadual = insEstadual;
	}

	public Set<ContratoPagamentoWeb> getContratoPagamentoWebs() {
		return contratoPagamentoWebs;
	}

	public void setContratoPagamentoWebs(Set<ContratoPagamentoWeb> contratoPagamentoWebs) {
		this.contratoPagamentoWebs = contratoPagamentoWebs;
	}

	public String getContratoEmNome() {
		return contratoEmNome;
	}

	public void setContratoEmNome(String contratoEmNome) {
		this.contratoEmNome = contratoEmNome;
	}

	public Set<ContratoCreditoPagamentoWeb> getContratoCreditoPagamentoWebs() {
		return this.contratoCreditoPagamentoWebs;
	}

	public void setContratoCreditoPagamentoWebs(Set<ContratoCreditoPagamentoWeb> contratoCreditoPagamentoWebs) {
		this.contratoCreditoPagamentoWebs = contratoCreditoPagamentoWebs;
	}

//	public Set<UsuarioWeb> getUsuarioWebs() {
//		return this.usuarioWebs;
//	}
//
//	public void setUsuarioWebs(Set<UsuarioWeb> usuarioWebs) {
//		this.usuarioWebs = usuarioWebs;
//	}

}